<%--
  Created by IntelliJ IDEA.
  User: 兰宦君
  Date: 2015/10/8
  Time: 19:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<html>
<head>
  <title>后台管理系统——出版社管理</title>
  <%@ include file="../../layout/import.jsp"%>

  <script type="text/javascript">
    function submit() {
      $.ajax({
        url: "/admin/addPublisher.do",
        data: $('#publisherForm').serialize(),
        method: "POST",
        dataType: "json",
        error: function () {
          alert("表单提交出错，请稍后再试");
        },
        success: function(response) {
          if(response.code == 0) {
            alert("添加成功");
            window.location.href = "/admin/publisher.do";

          }
          else {
            alert(response.description);
          }
        }
      });
    }
  </script>

</head>
<body>
<%@ include file="nav.jsp"%>

<div class="container" style="min-height: 72%">
  <div class="col-sm-8 col-sm-offset-2">

    <form class="form" id="publisherForm">
      <div class="form-group">
        <label for="name">出版社名</label>
        <input type="text" class="form-control" id="name" name="name">
      </div>
      <div class="form-group">
        <label for="linkname">联系人</label>
        <input type="text" class="form-control" id="linkname" name="linkname">
      </div>
      <div class="form-group">
        <label for="address">地址</label>
        <input type="text" class="form-control" id="address" name="address">
      </div>
      <div class="form-group">
        <label for="email">邮箱</label>
        <input type="email" class="form-control" id="email" name="email">
      </div>
      <div class="form-group">
        <label for="phone">电话</label>
        <input type="text" class="form-control" id="phone" name="phone">
      </div>
        <div class="form-group">
            <label for="phone">网址</label>
            <input type="text" class="form-control" id="website" name="website">
        </div>

        <a class="btn btn-primary" onclick="submit()">提交</a>

    </form>

  </div>
</div>

<%@ include file="../footer.jsp"%>
</body>
</html>